#include "photon.h"

photon::photon()
{
	inside = false;
	//bounces = (unsigned int)randNumber(1.49);
	bounces = 0;
}
photon::photon(point _pos, vector3 _dir, color _intens, double _pow)
{
	position		= _pos;
	direction		= _dir;
	intensity		= _intens;
	power			= _pow;
	inside			= false;

	//bounces = (unsigned int)randNumber(1.49);
	bounces = 0;
}
photon::~photon()
{

}

double photon::distanceFrom(point from)
{
	vector3 temp(position, from);
	return temp.width();
}
point photon::getPosition()
{
	return position;
}
vector3 photon::getDirection()
{
	return direction;
}
color photon::getIntensity()
{
	return intensity;
}
double photon::getPower()
{
	return power;
}
bool photon::isinside()
{
	return inside;
}
void photon::setPosition(point Position)
{
	position = Position;
}
void photon::setDirection(vector3 Direction)
{
	direction = Direction;
}
void photon::setIntensity(color Intensity)
{
	intensity = Intensity;
}
void photon::setPower(double Power)
{
	power = Power;
}
void photon::scalePower(double scaleFactor)
{
	power*=scaleFactor;
}
void photon::setIsInside(bool isOrIsNot)
{
	inside = isOrIsNot;
}
photon & photon::operator=( const photon &other )
{
	this->direction = other.direction;
	this->intensity = other.intensity;
	this->position	= other.position;
	this->power		= other.power;
	return *this; 
}
bool photon::operator==( const photon &other )
{
	if ( this->power == other.power )
		return true;
	else 
		return false;
}
bool photon::operator!=( const photon &other )
{
	if ( this->power == other.power )
		return false;
	else 
		return true;
}
bool photon::operator>( photon &other )
{
	if (this->power > other.power)
		return true;
	else
		return false;
}
bool photon::operator<( photon &other )
{
	if (this->power < other.power)
		return true;
	else
		return false;
}
bool photon::operator>=( photon &other )
{
	if (this->power >= other.power)
		return true;
	else
		return false;
}
bool photon::operator<=( photon &other )
{
	if (this->power <= other.power)
		return true;
	else
		return false;
}
